package com.test

import com.subpackage.BasePack
import kotlin.test.Test
import java.io.File

class ZipUtilsTest {
    @Test
    fun test() {
        val saveFilePath = "C:\\Users\\boge\\demoBucketName"
        val apkFilePath = "C:\\Users\\boge\\demoBucketName/apk/"
        val updateFilePath = "C:\\Users\\boge\\demoBucketName/games/"

        val cf = BasePack()

        // 获得js文件
        cf.packZip(
            saveFilePath, "fruit.zip", arrayOf(updateFilePath),
            "assets/aFruit", "js/fruit.js"
        )

        // 游戏资源包

//        // 分包 main
//        cf.packZip(saveFilePath, updateFilePath, "main.zip",
//                "assets/common", "assets/configs", "assets/resConfig.xml", "apk");
        val files = File(updateFilePath)
        val lists = files.listFiles()?.map { it.path }?.toMutableList()
        if (lists == null) return
        lists.add(0, apkFilePath)
        cf.packZip(saveFilePath, "main.zip", lists.toTypedArray(), "")
    }
}
